//
//  UINavigationController+Safe.m
//  niuguwang
//
//  Created by BrightLi on 2021/7/19.
//  Copyright © 2021年 taojinzhe. All rights reserved.
//

#import "UIApplication+Safe.h"
#import "YMSafeUtil.h"

@implementation UIApplication(Safe)

static const void *navStackLastChangedTimeKey=&navStackLastChangedTimeKey;

+ (void) safe_fixed
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [YMSafeUtil swizzleInstance:[self class]
                    sel1:@selector(setStatusBarStyle:animated:)
                    sel2:@selector(safe_setStatusBarStyle:animated:)];
        [YMSafeUtil swizzleInstance:[self class]
                    sel1:@selector(setStatusBarHidden:withAnimation:)
                    sel2:@selector(safe_setStatusBarHidden:withAnimation:)];
        [YMSafeUtil swizzleInstance:[self class]
                    sel1:@selector(setStatusBarHidden:)
                    sel2:@selector(safe_setStatusBarHidden:)];
        [YMSafeUtil swizzleInstance:[self class]
                              sel1:@selector(canOpenURL:)
                              sel2:@selector(safe_canOpenURL:)];
    });
}

- (void) safe_setStatusBarHidden:(BOOL)statusBarHidden
{
    [self safe_setStatusBarHidden:statusBarHidden];
}

- (void) safe_setStatusBarHidden:(BOOL)statusBarHidden withAnimation:(UIStatusBarAnimation)animation
{
    [self safe_setStatusBarHidden:statusBarHidden withAnimation:animation];
}

- (void) safe_setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated
{
    [self safe_setStatusBarStyle:statusBarStyle animated:animated];
}

- (BOOL) safe_canOpenURL:(NSURL *)url
{
    return [self safe_canOpenURL:url];
}

@end
